public class Threaddemo4 {
    public static void main(String[] args) throws InterruptedException {

        //        Runnable runnable = new Runnable() {
//            @Override
//            public void run() {
//                int i = 0;
//                while(i < 100) {
//                    System.out.println(i);
//                    i++;
//                }
//                System.out.println("t 线程结束！");
//            }
//        };


        Thread t = new Thread(new Runnable() {
            @Override
            public void run() {
                int i = 0;
                while(i < 100) {
                    System.out.println(i);
                    i++;
                }
                System.out.println("t 线程结束！");
            }
        });
        t.start();
        t.join();
        System.out.println("main 线程结束！");
    }
}
